package cn.ynrcb.personnelfile.admin.service.impl;

import cn.ynrcb.personnelfile.admin.entity.FileEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ynrcb.personnelfile.common.utils.PageUtils;
import cn.ynrcb.personnelfile.common.utils.Query;

import cn.ynrcb.personnelfile.admin.dao.PersonnelInfoDao;
import cn.ynrcb.personnelfile.admin.entity.PersonnelInfoEntity;
import cn.ynrcb.personnelfile.admin.service.PersonnelInfoService;


@Service("personnelInfoService")
public class PersonnelInfoServiceImpl extends ServiceImpl<PersonnelInfoDao, PersonnelInfoEntity> implements PersonnelInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PersonnelInfoEntity> page = this.page(
                new Query<PersonnelInfoEntity>().getPage(params),
                new QueryWrapper<PersonnelInfoEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public void saveFile(String id, String fileName, String filePath) {
        baseMapper.saveFile(id, fileName, filePath);
    }

    @Override
    public FileEntity getFileById(String id) {
        return baseMapper.getFileById(id);
    }

    @Override
    public void deleteByFileId(String id) {
        baseMapper.deleteByFileId(id);
    }

}